//################################
// 版权所有：中国农业银行软件开发中心
// 系统名称：移动办公应用-手机版
// 文件名称：indicatorModal.js
// 创建时间：2016年09月26日
// 创建人员：Panda
// 功能说明：等待提示Modal
//################################

'use strict';

import React, {Component} from 'react';
import {
    View,
    Text,
    ActivityIndicator,
    StyleSheet,
    Dimensions,
} from 'react-native';

import Modal from '../modal';
import {
    Colors,
} from '../../common';

const WINDOW_WIDTH = Dimensions.get('window').width;
const WINDOW_HEIGHT = Dimensions.get('window').height;

class IndicatorModal extends Component {
    constructor(props) {
        super(props);

        this.state = {
            isOpen: false,
        };
    }
    
    openModal() {
        this.setState({
            isOpen: true,
        });
    }

    closeModal() {
        this.setState({
            isOpen: false,
        });
    }

    render() {
        return (
            <Modal isOpen={this.state.isOpen} backdropPressToClose={false} isBackdropColorTransparent={true}>
                <View style={styles.container}>
                    <View style={styles.innercontainer}>
                        <View style={styles.indicatorview}>
                            <ActivityIndicator animating={true} style={styles.indicator} size={'large'} color={Colors.green} />
                            <Text style={styles.indicatortext}>{this.props.text}</Text>
                        </View>
                    </View>
                </View>
            </Modal>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        width: WINDOW_WIDTH,
        height: WINDOW_HEIGHT,
        alignItems: 'center',
        justifyContent: 'center',
    },
    innercontainer: {
        borderRadius: 20,
        backgroundColor: 'white',
        borderWidth: 1,
        borderColor: Colors.green,
        width: 180,
        height: 180,
    },
    indicatorview: {
        margin: 20,
        alignItems: 'center',
        justifyContent: 'center',
    },
    indicator: {
        height: 120,
        alignItems: 'center',
        justifyContent: 'center',
    },
    indicatortext: {
        color: Colors.green,
    },
});

export default IndicatorModal;